package com.timoon.sample.dao;

import java.util.List;

import javax.annotation.PostConstruct;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.timoon.sample.dao.model.ProductProperty;
import com.timoon.sample.dao.model.ProductPropertyExample;

@Repository
public class ProductPropertyDAOImpl extends SqlMapClientDaoSupport implements ProductPropertyDAO {

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public ProductPropertyDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public void insert(ProductProperty record) {
		getSqlMapClientTemplate().insert(
				"product_property.abatorgenerated_insert", record);
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int updateByPrimaryKey(ProductProperty record) {
		int rows = getSqlMapClientTemplate().update(
				"product_property.abatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int updateByPrimaryKeySelective(ProductProperty record) {
		int rows = getSqlMapClientTemplate().update(
				"product_property.abatorgenerated_updateByPrimaryKeySelective",
				record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public List selectByExample(ProductPropertyExample example) {
		List list = getSqlMapClientTemplate().queryForList(
				"product_property.abatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public ProductProperty selectByPrimaryKey(Integer id) {
		ProductProperty key = new ProductProperty();
		key.setId(id);
		ProductProperty record = (ProductProperty) getSqlMapClientTemplate()
				.queryForObject(
						"product_property.abatorgenerated_selectByPrimaryKey",
						key);
		return record;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int deleteByExample(ProductPropertyExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"product_property.abatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int deleteByPrimaryKey(Integer id) {
		ProductProperty key = new ProductProperty();
		key.setId(id);
		int rows = getSqlMapClientTemplate().delete(
				"product_property.abatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int countByExample(ProductPropertyExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"product_property.abatorgenerated_countByExample", example);
		return count.intValue();
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int updateByExampleSelective(ProductProperty record,
			ProductPropertyExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"product_property.abatorgenerated_updateByExampleSelective",
				parms);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	public int updateByExample(ProductProperty record,
			ProductPropertyExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"product_property.abatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This class was generated by Abator for iBATIS. This class corresponds to the database table product_property
	 * @abatorgenerated  Sat Jun 08 16:09:35 CST 2013
	 */
	private static class UpdateByExampleParms extends ProductPropertyExample {
		private Object record;

		public UpdateByExampleParms(Object record,
				ProductPropertyExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@javax.annotation.Resource(name="sqlMapClient")
	private SqlMapClient sqlMapClient;
	
	@PostConstruct
	public void addSqlMapClient() {
		// TODO Auto-generated constructor stub
		this.setSqlMapClient(sqlMapClient);
	}
}